package wo.esys.controller;
import javax.annotation.Resource;

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import wo.common.entity.WoPage;
import wo.esys.dto.MenuDto;
import wo.esys.service.MenuService;
import wo.esys.vo.WoGrid;

/**
 * @author cailei
 * @date 2018年11月14日
 */
@Controller
@RequestMapping("/esys/menu")
public class MenuController {
	private final static Logger LOG = LogManager.getLogger(MenuController.class);
	
	/**
	 * @return
	 */
	@GetMapping
	public String toMain () {
		return "menu/main";
	}
	
	@Resource
	private MenuService menuService;
	
	/**
	 * @param page
	 * @param rows
	 * @param searchContent
	 * @return
	 */
	@RequestMapping("/list")
	@ResponseBody
	WoGrid getList(Long page, Long rows, String searchContent) {
		WoPage<MenuDto> data =  menuService.getPageData (page, rows, searchContent);
		return new WoGrid<MenuDto> (data);
	}
	
	/**
	 * @return
	 */
	@GetMapping("/selector")
	public String toSelector () {
		return "menu/selector";
	}
}
